package com.hd.openapi.web.cotenollen;


import com.hd.openapi.common.ResponseResult;
import com.hd.openapi.common.ResultTable;
import com.hd.openapi.entity.Menu;
import com.hd.openapi.servies.cdmenuser;
import com.hd.openapi.servies.pageroleser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;
import java.util.List;

@RestController
@RequestMapping("/menu")
public class cdmenudata {
    @Autowired
    private cdmenuser a;

    @Autowired
    private pageroleser ser;

    @RequestMapping("/list")
    public ResultTable info(Integer page, Integer limit){
      return a.getpagelimit(page,limit);
    }
    @RequestMapping("/add")
    public ResponseResult add(Menu menu){
        return a.adddata(menu);
    }
    @RequestMapping("/update")
    public ResponseResult update(Menu menu){
        return a.updatadata(menu);
    }
    @RequestMapping("/info")
    public Menu info(Integer id){
        return a.getmenudata(id);
    }
    @RequestMapping("/tree")
    public List<Menu> tree(){
        return ser.getmenualldata ();
    }
    @RequestMapping("/delete")
    private ResponseResult delete(Integer[] ids){
        return  a.deletedata(ids);
    }
}
